package com.doge.walknovel.business.home.discover.viewholders

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.doge.walknovel.api.model.StrategyInfo
import com.doge.walknovel.business.home.discover.STRATEGY_MORE
import com.doge.walknovel.core.base.adapters.AdapterCallback
import com.doge.wnpro.databinding.CellDiscoverStrategyBinding
import com.doge.walknovel.utils.setOnClickCallback

class DiscoverStrategyViewHolder(
    parent: ViewGroup,
    callback: AdapterCallback,
    private val binding: CellDiscoverStrategyBinding = CellDiscoverStrategyBinding.inflate(
        LayoutInflater.from(parent.context), parent, false),
) : RecyclerView.ViewHolder(binding.root) {
    init {
        binding.more.setOnClickCallback {
            callback.invoke(STRATEGY_MORE, itemView.tag)
        }
    }

    fun bind(item: StrategyInfo) {
        itemView.tag = item
        binding.strategyTitle.text = item.titleName
    }
}